<!--
 * @Author: your name
 * @Date: 2022-05-04 14:50:11
 * @LastEditTime: 2022-05-04 14:55:04
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \算法测试\day0906\937.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var reorderLogFiles = function (logs) {
            let numberArr = [], charArr = [];
            for (let i = 0; i < logs.length; i++) {
                if (logs[i].split(" ")[1][0].charCodeAt() < 97 || logs[i].split(" ")[1][0].charCodeAt() > 122) {
                    numberArr.push(logs[i]);
                } else {
                    charArr.push(logs[i]);
                }
            }
            charArr.sort((a, b) => {
                let str1 = a.split(" ").slice(1).join(" "), str2 = b.split(" ").slice(1).join(" ");
                if (str1 !== str2) {
                    return str1 < str2;
                } else {
                    return a > b;
                }
            })
            return charArr.concat(numberArr);
        };
        console.log(reorderLogFiles(["dig1 8 1 5 1","let1 art can","dig2 3 6","let2 own kit dig","let3 art zero"]));
        console.log('own kit dig' > 'art zero');
    </script>
</body>

</html>